package com.credithc.signature.common.service;

import com.credithc.signature.common.mapper.SignatureLogExtMapper;
import com.credithc.signature.common.mapper.SignatureLogMapper;
import com.credithc.signature.common.po.SignatureLog;
import com.credithc.signature.common.po.SignatureLogExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 描述：request_log_ext表与request_log表同时操作服务<br/>
 * 作者：sunyang
 * 创建：2019/5/29 16:05
 * 版本：v1.0.0<br/>
 */
@Service
public class LogAndExtService {
    @Autowired
    private SignatureLogExtMapper signatureLogExtMapper;

    @Autowired
    private SignatureLogMapper signatureLogMapper;

    @Transactional(rollbackFor = Throwable.class)
    public int insertSelective(SignatureLogExt signatureLogExt, SignatureLog signatureLog){
        signatureLogExtMapper.insertSelective(signatureLogExt);
        signatureLog.setRefId(signatureLogExt.getId());
        return signatureLogMapper.insertSelective(signatureLog);
    }
}
